n=int(input())
a=list(map(int,input().strip().split()))
mn=min(a)
b=[]
for i in range(n):
if a[i]==mn:b.append(i)
mnd=b[1]-b[0]
for i in range(len(b)-1):
mnd=min(mnd,b[i+1]-b[i])
print(mnd)
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int> > ck;
int main()
{
int n,i,x,y;
cin>>n;
for(i=0;i<n;i++)
{
cin>>x;
ck.push_back({x,i});
}
sort(ck.begin(),ck.end());
x=ck[0].first;
int mn=INT_MAX;
for(i=1;i<n;i++)
{
if(ck[i].first==x)
{
mn=min(mn,abs(ck[i].second-ck[i-1].second));
}
else break;
}
cout<<mn<<endl;
}
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |
Divisible | Three primes |
Coprimes | Cost of balloons |
One String No Trouble | Help Jarvis! |
Lift queries | Goki and his breakup |
Ali and Helping innocent people | Book of Potion making |
Duration | Birthday Party |
e-maze-in | Bricks Game |
Char Sum | Two Strings |
Anagrams | Prime Number |
Lexical Sorting Reloaded | 1514A - Perfectly Imperfect Array |
580A- Kefa and First Steps | 1472B- Fair Division |